import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.UIManager;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.Toolkit;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPasswordField;




public class RegistrationGui extends JFrame {

	private JTextField usenameField;
	private JTextField emailField;
	private JPasswordField passwordField;


	/**
	 * Create the frame.
	 */
	public RegistrationGui() {
		setForeground(Color.WHITE);
		setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\User\\Documents\\Software Eng project\\pcs\\logo8.jpg"));
		setTitle("Sign up");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 400, 210);
		getContentPane().setBackground(new Color(210, 105, 30));
		
		// Important to make GUI look awesome
		try {
				UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			} 
		catch (Throwable e) {
				e.printStackTrace();
			}
		
		JLabel usernameLabel = new JLabel("Username");
		usernameLabel.setForeground(Color.WHITE);
		
		JLabel passwordLabel = new JLabel("Password");
		passwordLabel.setForeground(Color.WHITE);
		
		JLabel emailLabel = new JLabel("Email address");
		emailLabel.setForeground(Color.WHITE);
		
		usenameField = new JTextField();
		usenameField.setColumns(10);
		
		emailField = new JTextField();
		emailField.setColumns(10);
		
		JButton createAccountButton = new JButton(" Create Account ");
		createAccountButton.setOpaque(false);
		createAccountButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			/*	LoginManager loginManager = new LoginManager(usernameField.getText(), new String(passwordField.getPassword()));
				
				isRegistered = loginManager.register();
				errorMessage = loginManager.getErrorMessage();
				errorLabel.setText(errorMessage);
				
				if (isRegistered) {
					dispose();	
				}
		*/	}
		});
		
		passwordField = new JPasswordField();
		GroupLayout gl_contentPane = new GroupLayout(getContentPane());
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addContainerGap()
							.addComponent(createAccountButton))
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(86)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
								.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
									.addComponent(usernameLabel)
									.addComponent(passwordLabel))
								.addComponent(emailLabel))
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_contentPane.createSequentialGroup()
									.addGap(18)
									.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
										.addComponent(emailField, GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)
										.addComponent(usenameField, GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)))
								.addGroup(gl_contentPane.createSequentialGroup()
									.addGap(18)
									.addComponent(passwordField, GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)))))
					.addGap(110))
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGap(33)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(usernameLabel)
						.addComponent(usenameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(passwordLabel)
						.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(emailField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(emailLabel))
					.addPreferredGap(ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
					.addComponent(createAccountButton)
					.addContainerGap())
		);
		getContentPane().setLayout(gl_contentPane);
	}
}
